package com.example.function.integration.service;

import com.example.function.integration.jrss.JrssSdkComponent;
import com.example.function.integration.mapper.CrlArchiveInfoExtendMapper;
import com.example.function.integration.mapper.CrlCreditApplyRecordExtendMapper;
import com.example.function.integration.mapper.CrlCreditApproveRecordExtendMapper;
import com.example.function.integration.mapper.CrlDebtIouRecordExtendMapper;
import com.example.function.integration.sftp.CommonSftpComponent;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * @description：公共测试抽象服务接口
 * @className：AbstractCommonTestService
 * @author：ext.fengcheng
 * @date：2023/9/7 10:26
 */
@Service
public class AbstractCommonDataService {

    /**
     * 初始化数据数量
     */
    public static final Integer INIT_NUM = 1000;
    @Resource(name = "initDBExecutor")
    protected ThreadPoolTaskExecutor executor;
    @Resource
    protected JrssSdkComponent jrssSdkComponent;
    @Resource
    protected CrlCreditApplyRecordExtendMapper crlCreditApplyRecordExtendMapper;
    @Resource
    protected CrlCreditApproveRecordExtendMapper crlCreditApproveRecordExtendMapper;

    public static final String TB_CREDIT_APPLY_RECORD = "crl_credit_apply_record";
    public static final String APPROVE_REQ_CONTENT = "{\"interfaceName\":\"JTCreditDecision\",\"mapData\":{\"btProperty\":\"48.3\",\"queryCount60\":\"-1\",\"certType\":\"10100\",\"addressUsedExist\":\"0\",\"activateTag\":\"UN_ACTIVATED\",\"bkTel\":\"13199876601\",\"addressUsedTime\":\"-1\",\"onlineAmountMax\":\"3\",\"accountUsageTimeLv\":\"5\",\"cardNo\":\"6210814540003178290\",\"pin\":\"jd_629e3c8505883\",\"queryCount180\":\"-1\",\"btRelationshipNetwork\":\"48.3\",\"mobileStability\":\"-1\",\"installmentCount180\":\"1\",\"profession\":\"4\",\"seq_no\":\"MCLCAE21088692438541436110401000\",\"mallAddress\":\"\",\"btLevel\":\"4\",\"fraudScore\":\"-1\",\"creditUsageAmount180\":\"5\",\"carLevel\":\"-1\",\"btPerformance\":\"67.9\",\"queryCount14\":\"-1\",\"certNo\":\"659001199406122427\",\"areaCode\":\"650109\",\"addressCredibility\":\"-1\",\"queryCount7\":\"-1\",\"btScore\":\"65.2\",\"idExpire\":\"20400617\",\"telCredibility\":\"-1\",\"creditUsageCount180\":\"3\",\"careerForecast\":\"-1\",\"telUsedTime\":\"-1\",\"queryCount\":\"-1\",\"telUsedExist\":\"0\",\"creditUsageTimeLv\":\"5\",\"applyAmount\":\"800000\",\"btCharacteristic\":\"48.3\",\"btIdentity\":\"48.3\",\"houseLevel\":\"-1\",\"bankNo\":\"CCB\",\"shopPhone\":\"13199876601\",\"queryCount90\":\"-1\",\"interestRate\":\"0.0005\",\"address\":\"新疆乌鲁木齐市米东区新疆乌鲁木齐市米东区\",\"queryCount30\":\"-1\",\"addressStability\":\"-1\",\"userTel\":\"13199876601\",\"userName\":\"刘莹莹\",\"incomeLevel\":\"-1\",\"installmentAmount180\":\"3\",\"onlineAmountLv\":\"1\",\"applyNo\":\"1430060956226052097\",\"businessType\":\"JT\"},\"orgCode\":\"85\",\"tenantId\":\"huaneng_trust\",\"token\":\"6fNiWIV6llaqdI6+yQhbew==\"}";
    public static final String APPROVE_RET_CONTENT = "{\"callType\":1,\"flowContext\":{},\"message\":\"执行成功\",\"passDecision\":1,\"resultCode\":\"000000\",\"resultData\":{\"seq_no\":\"MCLCAE21088692438541436110401000\",\"checkStatus\":\"SUCCESS\",\"checkAmount\":\"800000\",\"hitRulesArray\":[\"00000\"],\"applyNo\":\"1430060956226052097\",\"blackFlag\":\"N\",\"hitRuleFirst\":\"00000\",\"sgySeqNo\":\"52261220210824145438\"},\"sgySeqNo\":\"52261220210824145438\"}";

    // 华能影像件配置
    public static final String SLASH = "/";
    protected static final Long QUERY_START_ID = 0L;
    protected static final Long QUERY_NUM = 1000L;
    protected static final Long BATCH_NUM = 200L;
    @Value("${jrss.selfBucket:electronic-contract-product}")
    protected String selfBucket;
    @Resource(name = "imageDownloadExecutor")
    protected ThreadPoolTaskExecutor imageDownloadExecutor;
    @Resource(name = "fileUploadExecutor")
    protected ThreadPoolTaskExecutor fileUploadExecutor;
    @Resource
    protected CrlDebtIouRecordExtendMapper iouRecordExtendMapper;
    @Resource
    protected CrlArchiveInfoExtendMapper archiveInfoExtendMapper;
    /**
     * 是否进行测试
     */
    protected static Boolean IS_TEST = false;
    protected static String END_ID = "endId";
    @Resource
    protected CommonSftpComponent commonSftpComponent;
    protected ConcurrentLinkedQueue<Integer> localQueue = new ConcurrentLinkedQueue<>();

}
